﻿<navigation:Page xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
                 x:Class="GroupChallenge.PlayersView"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                 xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
                 xmlns:ctrls="clr-namespace:GroupChallenge.Controls"
                 mc:Ignorable="d"
                 d:DesignWidth="640"
                 d:DesignHeight="480"
                 Style="{StaticResource PageStyle}">
    <Grid x:Name="LayoutRoot">
        <ScrollViewer x:Name="PageScrollViewer"
                      Style="{StaticResource PageScrollViewerStyle}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="118*" />
                    <RowDefinition Height="352*" />
                </Grid.RowDefinitions>
                <sdk:DataGrid x:Name="PlayersDataGrid"
                              IsReadOnly="True"
                              AutoGenerateColumns="False"
                              Grid.Row="1">
                    <sdk:DataGrid.Columns>
                        <sdk:DataGridTextColumn CanUserReorder="True"
                                                CanUserResize="True"
                                                CanUserSort="True"
                                                Header="Current Score"
                                                Width="Auto"
                                                Binding="{Binding Path=CurrentScore}" />
                        <sdk:DataGridTextColumn CanUserReorder="True"
                                                CanUserResize="True"
                                                CanUserSort="True"
                                                Header="Nick Name"
                                                Width="150"
                                                Binding="{Binding Path=NickName}" />
                        <sdk:DataGridTextColumn CanUserReorder="True"
                                                CanUserResize="True"
                                                CanUserSort="True"
                                                Header="Full Name"
                                                Width="150"
                                                Binding="{Binding Path=FullName}" />
                        <sdk:DataGridTextColumn CanUserReorder="True"
                                                CanUserResize="True"
                                                CanUserSort="True"
                                                Header="Picture Id"
                                                Width="Auto"
                                                Binding="{Binding Path=PlayerId}" />
                    </sdk:DataGrid.Columns>
                </sdk:DataGrid>
                <Grid Name="grid1">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="108" />
                        <ColumnDefinition Width="524" />
                    </Grid.ColumnDefinitions>
                    <StackPanel Grid.Column="0">
                        <Button Content="Join"
                                Height="38"
                                Click="JoinButton_Click" />
                        <Button Content="Leave"
                                Height="38"
                                Click="LeaveButton_Click" />
                        <Button Content="Refresh List"
                                Height="38"
                                Click="RefreshListButton_Click" />
                    </StackPanel>
                    <Grid Grid.Column="1">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="90" />
                            <ColumnDefinition Width="182*" />
                            <ColumnDefinition Width="252*" />
                        </Grid.ColumnDefinitions>
                        <TextBlock Grid.Row="0"
                                   Grid.Column="0"
                                   Text="Nick Name:"
                                   VerticalAlignment="Center"
                                   HorizontalAlignment="Right" />
                        <TextBox Grid.Column="1"
                                 x:Name="NickNameTextBox"
                                 VerticalAlignment="Center"
                                 Text="{Binding ElementName=PlayersDataGrid, Path=SelectedItem.NickName, Mode=OneWay}"
                                 Margin="0,8,21,7" />
                        <TextBlock Grid.Row="1"
                                   Grid.Column="0"
                                   Text="Full Name:"
                                   VerticalAlignment="Center"
                                   HorizontalAlignment="Right" />
                        <TextBox Grid.Row="1"
                                 Grid.Column="1"
                                 x:Name="FullNameTextBox"
                                 Text="{Binding ElementName=PlayersDataGrid, Path=SelectedItem.FullName, Mode=OneWay}"
                                 VerticalAlignment="Center"
                                 Margin="0,8,21,8" />
                        <TextBlock Grid.Row="2"
                                   Grid.Column="0"
                                   Text="Picture Id:"
                                   VerticalAlignment="Center"
                                   HorizontalAlignment="Right" />
                        <TextBox Grid.Row="2"
                                 Grid.Column="1"
                                 x:Name="PlayerIdTextBox"
                                 Text="{Binding ElementName=PlayersDataGrid, Path=SelectedItem.PlayerId, Mode=OneWay}"
                                 VerticalAlignment="Center"
                                 Margin="0,8,110,8" />
                        <ctrls:PlayerImageView Grid.Column="2"
                                               x:Name="playerImageView1"
                                               Grid.RowSpan="3"
                                               Margin="0,0,75,0"
                                               DataContext="{Binding ElementName=PlayersDataGrid, Path=SelectedItem.PlayerId, Converter={StaticResource PlayerIdToPlayerImageConverter}}" />
                    </Grid>
                </Grid>
            </Grid>
        </ScrollViewer>
    </Grid>
</navigation:Page>